<?php
namespace Plugin\Attractions\Commerce\Schema\Commerce_contract;

use Plugin\Attractions\Commerce\Model\Commerce_contract\CommerceContract;
use Hyperf\Swagger\Annotation\Property;
use Hyperf\Swagger\Annotation\Schema;

/**
 * 合同
 */
#[Schema(title: 'CommerceContractSchema')]
class CommerceContractSchema implements \JsonSerializable
{
    #[Property(property: 'id', title: '合同编号', type: 'bigint')]
    public string $id;

    #[Property(property: 'merchant_id', title: '商户ID', type: 'bigint')]
    public string $merchant_id;

    #[Property(property: 'contract_title', title: '合同标题', type: 'varchar')]
    public string $contract_title;

    #[Property(property: 'party_a', title: '甲方', type: 'varchar')]
    public string $party_a;

    #[Property(property: 'party_b', title: '乙方', type: 'varchar')]
    public string $party_b;

    #[Property(property: 'contract_amount', title: '合同金额', type: 'decimal')]
    public string $contract_amount;

    #[Property(property: 'sign_date', title: '签订日期', type: 'date')]
    public string $sign_date;

    #[Property(property: 'effective_date', title: '生效日期', type: 'date')]
    public string $effective_date;

    #[Property(property: 'expiry_date', title: '到期日期', type: 'date')]
    public string $expiry_date;

    #[Property(property: 'contract_file', title: '合同文件路径', type: 'varchar')]
    public string $contract_file;

    #[Property(property: 'attachment_files', title: '附件文件路径（JSON格式）', type: 'array')]
    public array $attachment_files;

    #[Property(property: 'payment_method', title: '付款方式1-银行转账,2-微信支付,3-支付宝支付,4-现金,5-其他付款方式', type: 'tinyint')]
    public string $payment_method;

    #[Property(property: 'remark', title: '合同备注', type: 'text')]
    public string $remark;

    #[Property(property: 'created_at', title: 'created_at', type: 'timestamp')]
    public string $created_at;

    #[Property(property: 'updated_at', title: 'updated_at', type: 'timestamp')]
    public string $updated_at;

    #[Property(property: 'deleted_at', title: 'deleted_at', type: 'timestamp')]
    public string $deleted_at;




    public function __construct(CommerceContract $model)
    {
       $this->id = $model->id;
       $this->merchant_id = $model->merchant_id;
       $this->contract_title = $model->contract_title;
       $this->party_a = $model->party_a;
       $this->party_b = $model->party_b;
       $this->contract_amount = $model->contract_amount;
       $this->sign_date = $model->sign_date;
       $this->effective_date = $model->effective_date;
       $this->expiry_date = $model->expiry_date;
       $this->contract_file = $model->contract_file;
       $this->attachment_files = $model->attachment_files;
       $this->payment_method = $model->payment_method;
       $this->remark = $model->remark;
       $this->created_at = $model->created_at;
       $this->updated_at = $model->updated_at;
       $this->deleted_at = $model->deleted_at;

    }

    public function jsonSerialize(): array
    {
        return ['id' => $this->id ,'contract_title' => $this->contract_title ,'party_a' => $this->party_a ,'party_b' => $this->party_b ,'contract_amount' => $this->contract_amount ,'sign_date' => $this->sign_date ,'effective_date' => $this->effective_date ,'expiry_date' => $this->expiry_date ,'contract_file' => $this->contract_file ,'attachment_files' => $this->attachment_files ,'payment_method' => $this->payment_method ,'remark' => $this->remark ,'created_at' => $this->created_at ,'updated_at' => $this->updated_at ,'deleted_at' => $this->deleted_at];
    }
}